package com.qf.mybatis01.entity;

import cn.hutool.core.util.RandomUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Book {

        private Integer id;
        private String name;
        private String author;
        private String publish;
        private Integer sort;

        public String toCSVString(){
                return this.getId()+","+this.getName()+","+this.getAuthor()+","+this.getPublish()+","+this.getSort();
        }
        public static List<String> listToString(List<Book> books){
                List<String> list=new ArrayList<>();
                for (Book book : books) {
                        String s = book.toCSVString();
                        list.add(s);
                }
                return list;
        }
}
